'''
静态方法和类方法
方法上加入@staticmethod
'''

from math import sqrt

class Triangle(object):

    def __init__(self, a, b, c):
        self._a = a
        self._b = b
        self._c = c

    # 静态方法 判断是否是三角形
    @staticmethod
    def is_valid(a, b, c):
        return a + b > c and a + c > b and b + c > a

    def area(self):
        s = (self._a + self._b + self._c) / 2
        return sqrt(s * (s - self._a) * (s - self._b) * (s - self._c))
    
def main():
    a, b, c = 3, 4, 5
    # 静态方法调用
    if Triangle.is_valid(a, b, c):
        t = Triangle(a, b, c)
        print(t.area())
    else:
        print('非法三角形')
    
if __name__ == '__main__':
    main()